package com.rocksdata.mc.ui.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.ctz.commonframe.ui.widget.AbsAdapter;
import com.ctz.commonframe.ui.widget.AdapterViewHolder;
import com.rocksdata.mc.R;
import com.rocksdata.mc.entity.AnnouncementInfo;

import java.util.List;

/**
 * Created by 陈堂正 on 2017/5/11.
 */

public class WidgetNoticeListAdapter extends AbsAdapter<AnnouncementInfo> {
    public WidgetNoticeListAdapter(Context context, List<AnnouncementInfo> datas) {
        super(context, datas, R.layout.item_widget_notice_list);
    }

    @Override
    public void convert(AdapterViewHolder holder, AnnouncementInfo data) {
        View readFlag = holder.getView(R.id.view_read_flag);
        TextView tvTitle = holder.getView(R.id.tv_notice_title);
        TextView tvDate = holder.getView(R.id.tv_notice_date);
        if(data.isRead()){
            readFlag.setVisibility(View.INVISIBLE);
        }else{
            readFlag.setVisibility(View.VISIBLE);
        }
        tvTitle.setText(data.getTitle());
        tvDate.setText(data.getPublishedTime());
    }
}
